<template>

    <div>
        <script :id="id" type="text/plain"></script>
    </div>

</template>

<script>
    export default {
        name: "UEditor",
        data() {
            return {
                ediotr: null,
            }
        },
        props: {
            id: {
                type: String
            },
            defaultMsg: {
                type: String,
                default: ''
            },
            config: {
                type: Object,
                default: function () {
                    return  {
                        initialFrameWidth: null,
                        initialFrameHeight: 350
                    }
                }
            }
        },
        created() {
            this.initEditor()
        },
        mounted() {

        },
        methods: {
            initEditor() {
                const _this = this;
                this.$nextTick(function () {
                    this.editor = UE.getEditor(this.id, _this.config); // 初始化UE
                    this.editor.addListener("ready", function () {
                        _this.editor.setContent(_this.defaultMsg); // 确保UE加载完成后，放入内容。
                    });
                    console.log("上传这堆错误不用理会，上传接口需自行开发配置");
                })
            },
            getUEContent() { // 获取内容方法
                return this.editor.getContent()
            },
            getUEContentTxt() { // 获取纯文本内容方法
                return this.editor.getContentTxt()
            }
        },
        destroyed() {
            this.editor.destroy();
        }
    }
</script>

<style rel="stylesheet/scss" lang="scss" scoped>


</style>